﻿using System;
using Thuoc24h.Business;

namespace Thuoc24h.Home.Pages
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindSildeData();
                ProductDiscount();
                ProductNew();
                ProductBanchay();
            }

        }

        private void BindSildeData()
        {
            string str = "";
            foreach (var item in ReviewRepository.GetAllSlides())
            {
                str += "<li><a href=\"" + item.LinkUrl + "\"> <img src=\"" + item.ImageUrl + "\" alt=\"" + item.Title + "\" /></a></li>";
            }

            ltrSlide.Text= str;
        }

        private void ProductDiscount()
        {
            rptProductDiscount.DataSource = ReviewRepository.GetProductDiscount(6);
            rptProductDiscount.DataBind();
        } 
        private void ProductNew()
        {
            rptProductNew.DataSource = ReviewRepository.GetProducNew(6);
            rptProductNew.DataBind();
        }

        private void ProductBanchay()
        {
            rptProductBanchay.DataSource = ReviewRepository.GetProducBanchay(6);
            rptProductBanchay.DataBind();
        }
    }
}